/*
 *  Signable.h
 *  TubeTruck
 *
 *  Created by Aeturnum on 6/3/08.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */

#pragma once

#include <vector>
#include "Signiture.h"

namespace TTP {
   namespace Crypt {
      
      class Signable {
      protected:
         Signiture mSig;
         bool mSigned;
         
         void clearSignature() {
            mSig.clear();
            mSig.insert(mSig.end(), 128, 0);
         }
         
      public:
         Signable() : mSigned(false){}
         Signable(std::vector<byte>& sig) : mSig(sig),  mSigned(false){}
         virtual ~Signable(){}
         
         virtual std::vector<byte> getUnsignedData() const = 0;
         
         void setSigniture(Signiture& s) {
            mSigned = true;
            mSig = s;
         }
         
         Signiture getSigniture() const {
            return mSig;
         }
         
         Signable& operator=(const Signable& o) {
            mSig = o.mSig;
            return *this;
         }
      };
      
   }
}